package com.yjd.comm.fs.file.impl;

import com.yjd.comm.fs.file.IFilePathResolve;
import com.yjd.comm.util.DateUtil;
import com.yjd.comm.vo.Constant.FsServiceTypeEnum;

import java.util.Calendar;
import java.util.UUID;

public class DefaultFilePathResolve implements IFilePathResolve {

	@Override
	public String getFileAbsPath(String fileRootPath, String fileStuff,
			FsServiceTypeEnum fsEnum) {
		StringBuilder result = new StringBuilder(fileRootPath);
		result.append(fsEnum.name())
				.append("/")
				.append(DateUtil.format(Calendar.getInstance().getTime(),
						"yyyy/MM/dd/"))
				.append(UUID.randomUUID().toString().replaceAll("-", ""))
				.append(fileStuff);
		return result.toString();
	}
}
